package com.rabc.web.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rabc.web.entity.SysUser;
import com.rabc.web.entity.vo.SysLoginVo;
import com.rabc.web.service.SysUserService;
import com.rabc.web.mapper.SysUserMapper;
import com.utils.AuthUtils;
import com.utils.EncryptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 27632
* @description 针对表【sys_user】的数据库操作Service实现
* @createDate 2024-07-04 21:22:37
*/
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService{

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser login(SysLoginVo user) {
        SysUser sysUser = baseMapper.selectOne(new QueryWrapper<SysUser>().eq("user_name", user.getUsername())
                .eq("password", EncryptionUtils.md5(user.getPassword())));
        return sysUser;
    }
    public List<SysUser> selectUserList(SysUser user){
        return sysUserMapper.selectUserList(user);
    }
}






